<%--
  登录页面
  Author: ZheL2
  Date: 2023/12/12
  Version: 1.0
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="m" uri="/WEB-INF/tld/mytag.tld"%>

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>登录 - 校园社团管理系统</title>
    <link rel="stylesheet" type="text/css" href="<c:url value='/resources/css/bootstrap.css'/>">
    <link rel="stylesheet" type="text/css" href="<c:url value='/resources/css/style.css' />">
    <script src="<c:url value='/resources/js/bootstrap.bundle.js'/> "></script>
</head>
<body>
    <div class="page-container">
        <jsp:include page="homeHeader.jsp"/>

        <div class="container mt-5" >
            <div class="row justify-content-center">
                <div class="col-lg-4 col-6 border rounded shadow" style=" background-color: #f2f2f2; padding: 20px; min-width: 450px">
                    <h2>用户登录</h2><br>
                    <form action="login" method="post">
                        <div class="form-group row">
                            <label for="username" class="col-3">账号:</label>
                            <div class="col-9">
                                <input type="text" class="form-control" id="username" name="username" required><br>
                            </div>
                        </div>
                        <div class="form-group row">
                            <label for="password" class="col-3">密码:</label>
                            <div class="col-9">
                                <input type="password" class="form-control" id="password" name="password" required><br>
                            </div>
                        </div>
                        <div class="form-group row">
                            <label for="role" class="col-3">登录类型：</label>
                            <div class="col-9">
                                <select class="form-control" id="role" name="role" required>
                                    <option value="user">普通用户</option>
                                    <option value="club_admin">社团管理员</option>
                                    <option value="system_admin">系统管理员</option>
                                </select><br>
                            </div>
                        </div>

                        <!-- 如果登录失败 -->
                        <c:if test="${loginError}">
                            <div class="row justify-content-end">
                                <p style="color: red;">登录失败，请重新登录</p>
                            </div>
                        </c:if>
                        <div class="row">
                            <div class="col-3 d-flex justify-content-start">
                                <a href="/" class="btn btn-secondary">取消</a>
                            </div>
                            <div class="col-9 d-flex justify-content-end">
                                <button type="submit" class="btn btn-outline-primary w-100">登录</button>
                            </div>
                        </div>
                    </form>
                    <p class="mt-3">还未注册？
                        <a href="register">注册</a>
                    </p>
                </div>
            </div>
        </div>

        <footer class="fixed-bottom">
            <m:footer/>
        </footer>

    </div>
</body>
</html>